// Data Base
// (c) jimon game studio

#ifndef JEH_IDATABASE
#define JEH_IDATABASE

#include "jeUnknown.h"
#include "jeStl.h"
#include "jeMemoryBuffer.h"
#include "IBlobBuffer.h"

namespace je
{
	namespace core
	{
		//! Data Base Query
		class IDataBase_Query:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~IDataBase_Query()
			{
			}

			//! Finalize
			virtual void Finalize() = 0;

			//! Eof
			virtual u1 Eof() = 0;

			//! Next Row
			virtual void NextRow() = 0;

			//! Return Int Field
			virtual s32 GetFields32(const jeStringc & FieldName,s32 DefaultValue = 0) = 0;

			//! Return Int Field
			virtual s32 GetFields32(s32 Index,s32 DefaultValue = 0) = 0;

			//! Return Float Field
			virtual f32 GetFieldf32(const jeStringc & FieldName,f32 DefaultValue = 0) = 0;

			//! Return Float Field
			virtual f32 GetFieldf32(s32 Index,f32 DefaultValue = 0) = 0;

			//! Return Boolean Field
			virtual u1 GetFieldu1(const jeStringc & FieldName,u1 DefaultValue = false) = 0;

			//! Return Boolean Field
			virtual u1 GetFieldu1(s32 Index,u1 DefaultValue = false) = 0;

			//! Return jeStringc Field
			virtual jeStringc GetFieldjeStringc(const jeStringc & FieldName,const jeStringc & DefaultValue = "") = 0;

			//! Return jeStringc Field
			virtual jeStringc GetFieldjeStringc(s32 Index,const jeStringc & DefaultValue = "") = 0;

			//! Return Field Binary Data
			virtual jeMemoryBuffer * GetFieldBuffer(const jeStringc & FieldName) = 0;

			//! Return Field Binary Data
			virtual jeMemoryBuffer * GetFieldBuffer(s32 Index) = 0;

			//! Is Field Exist
			virtual u1 IsFieldExist(const jeStringc & FieldName) = 0;
		};

		//! Data Base
		class IDataBase:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~IDataBase()
			{
			}

			//! Query
			virtual IDataBase_Query * Query(const jeStringc & Query) = 0;

			//! Return Field Binary Data With Streaming
			virtual IBlobBuffer * GetBlobBuffer(const jeStringc & Table,const jeStringc & FieldName,const s32 RowId) = 0;
		};

		//! Create Data Base
		JE_ENGINE_FUNCTION_API IDataBase * JE_ENGINE_FUNCTION_CALL CreateDataBase(const jeStringc & FileName);
	}
}

#endif
